{{!
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*     http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}}
<div class="modal fade" id="asset_manager_dialog">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close" {{action 'close'}}>
          <span aria-hidden="true">&times;</span>
        </button>
        <h4 class="modal-title">Asset Manager</h4>
      </div>
      <div class="modal-body">
        {{input type="text" class="form-control marginBottom10" name="assetSearchCriteria" value=assetSearchCriteria placeholder="Asset Search"}}
        {{#if (and errorMsg (not (eq errorMsg "")))}}
          <div id="alert"class="alert alert-danger alert-dismissible" role="alert">
              {{errorMsg}}
          </div>
        {{/if}}
        {{#if (and successMsg (not (eq successMsg "")))}}
            <div id="alert"class="alert alert-success alert-dismissible" role="alert">
                {{successMsg}}
            </div>
        {{/if}}
        <div class="panel panel-default mb0 asset-list-panel-header">
          <table class="table asset-list-header-table listing table-striped table-hover table-bordered" cellspacing="0" width="100%">
            <thead>
              <tr>
                <th class="col-xs-3">Name</th>
                <th class="col-xs-3">Type</th>
                <th class="col-xs-3">Description</th>
                <th class="col-xs-3"></th>
              </tr>
            </thead>
          </table>
        </div>
        <div class="panel panel-default asset-list-panel-body {{if (and (eq filteredAssetList.length 0) (eq errorMsg "")) 'no-asset-records'}}">
          {{#if (and (eq filteredAssetList.length 0) (eq errorMsg ""))}}
            <span>No assets</span>
          {{/if}}
          <table id="asset-list" class="table asset-list listing table-striped table-hover table-bordered" cellspacing="0" width="100%">
            <tbody>
              {{#each filteredAssetList as |asset idx|}}
                <tr data-asset-id="{{asset.id}}">
                  <td class="col-xs-3">{{asset.name}}</td>
                  <td class="col-xs-3">{{asset.type}}</td>
                  <td class="col-xs-3">{{asset.description}}</td>
                  <td class="col-xs-3"><span {{action 'showDeleteAssetWarning' asset}}><i class="fa fa-trash-o"></i></span></td>
                </tr>
              {{/each}}
            </tbody>
          </table>

        </div>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal" {{action 'close'}}>Cancel</button>
      </div>
    </div>
  </div>
</div>
{{#if showingDeleteAssetWarning}}
  <div id="asset-delete-confirm-dialog">
    {{#confirmation-dialog title="Confirm asset delete"
      confirmationMessage="Do you want to delete this asset ?"
      okBtnText="Continue" cancelBtnText="Cancel" onOk="deleteAsset"}}{{/confirmation-dialog}}
  </div>
{{/if}}
{{#if inProgress}}
  {{spin-spinner lines=13 length=20 width=10 top=200}}
{{/if}}
